{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X坐标： [[0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5]]\n",
      "Y坐标: [[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3]]\n"
     ]
    }
   ],
   "source": [
    "def custom_meshgrid(x, y):\n",
    "    num_x = len(x); num_y = len(y)\n",
    "    X = []; Y = []\n",
    "    for i in range(num_y):\n",
    "        X_row = []; Y_row = []\n",
    "        for j in range(num_x):\n",
    "            X_row.append(x[j])\n",
    "            Y_row.append(y[i])\n",
    "        X.append(X_row); Y.append(Y_row)\n",
    "    return X,Y\n",
    "\n",
    "x = [0,1,2,3,4,5]\n",
    "y = [0,1,2,3]\n",
    "X, Y = custom_meshgrid(x, y)\n",
    "print(\"X坐标：\",X)\n",
    "print(\"Y坐标:\",Y)\n",
    "      \n",
    "      \n",
    "    \n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
